<?

class Button extends AbstractToolBarElement
{

    function Button() {
    }

    function render($sel) {
        return '';
    }

    function action ($sel) {
        return '';
    }

    function renderButton($id, $link, $text, $tooltiptext = '', $attrubutes = '') {
        if ($tooltiptext == '') {
            $tooltiptext = $text;
        }
        $img = "images/button-{$id}.gif";
        $res = <<<BUTTON
<td class="buttonNormal" onMouseOver="if (this.className!='buttonSelected') this.className='buttonOver';" onMouseOut="if (this.className!='buttonSelected') this.className='buttonNormal';" onClick="location.href='{$link}';" id='{$id}button'><table cellspacing="0" cellpadding="0"><tr><td valign="middle" width="20"><a href='{$link}'><img src="{$img}" width="20" height="20"  alt="{$tooltiptext}" title="{$tooltiptext}"></a></td><td valign="middle"><a href='{$link}' class='toolbarlink'><nobr>{$text}&nbsp;</nobr></a></td></tr></table></td>
BUTTON;
        return $res;
    }

    function renderDefaultButton($id, $link, $text, $tooltiptext = '', $attrubutes = '') {
        $res = Button::renderButton($id, $link, $text, $tooltiptext = '', $attrubutes = '');
        //$res = str_replace('buttonNormal','buttonDefault',$res);
        $res = str_replace($text,'<b>'.$text.'</b>',$res);
        return $res;
    }


    function renderDialogButton($id, $text, $tooltiptext = '') {
        $img = "images/button-{$id}.gif";
        $res = <<<BUTTON
<td class="buttonNormal" onClick="toggleDialogBar('{$id}');return false;" onMouseOver="if (this.className!='buttonSelected') this.className='buttonOver';" onMouseOut="if (this.className!='buttonSelected') this.className='buttonNormal';" id='{$id}button'><table cellspacing="0" cellpadding="0"><tr><td valign="middle" width="20"><a href="#"><img src="{$img}" width="20" height="20"  alt="{$tooltiptext}" title="{$tooltiptext}"></a></td><td valign="middle"><a href="#" class='toolbarlink'><nobr>{$text}&nbsp;</nobr></a></td></tr></table></td>
BUTTON;
        return $res;
    }

    function renderPopupButton($id, $wnd, $text, $tooltiptext = '') {
        $img = "images/button-{$id}.gif";
        $res = <<<BUTTON
<td class="buttonNormal" onClick="window.open({$wnd});return false;" onMouseOver="if (this.className!='buttonSelected') this.className='buttonOver';" onMouseOut="if (this.className!='buttonSelected') this.className='buttonNormal';" id='{$id}button'><table cellspacing="0" cellpadding="0"><tr><td valign="middle" width="20"><a href="#"><img src="{$img}" width="20" height="20"  alt="{$tooltiptext}" title="{$tooltiptext}"></a></td><td valign="middle"><a href="#" class='toolbarlink'><nobr>{$text}&nbsp;</nobr></a></td></tr></table></td>
BUTTON;
        return $res;
    }

    function renderDisabledButton($id, $text, $tooltiptext = '') {
        $img = "images/button-{$id}.gif";
        $res = <<<BUTTON
<td class="buttonDisabled"><table cellspacing="0" cellpadding="0"><tr><td valign="middle" width="20"><img src="{$img}" width="20" height="20"  alt="{$tooltiptext}" title="{$tooltiptext}"></td><td valign="middle"><font color="gray"><nobr>{$text}</nobr></font></td></tr></table></td>
BUTTON;
        return $res;
    }

}

?>